﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "College")]
    public partial class CollegeInfo : IDetach
    {
        public CollegeInfo()
        {
            Detach();
        }
        #region Model
        private int _id;

        private EntitySet<SubjectInfo> _subjectInfo;
        [System.Data.Linq.Mapping.Association(Storage = "_subjectInfo", ThisKey = "Id", OtherKey = "CollegeId")]
        public EntitySet<SubjectInfo> SubjectInfo
        {
            get { return this._subjectInfo; }
            set { this._subjectInfo.Assign(value); }
        }


        private string _name = "";
        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("学院名称")]
        [Required(ErrorMessage = "必须填写")]
        public string Name
        {
            set { _name = value; }
            get { return _name; }
        }
        #endregion Model

        public void Detach()
        {
            this._subjectInfo = new EntitySet<SubjectInfo>();
        }
    }
}
